﻿using System.Collections.Generic;

namespace OpenQuant.Quik
{
    public class Quote: IEqualityComparer<Quote>
    {
        public double BidPrice { get; set; }

        public int BidVolume { get; set; }

        public double AskPrice { get; set; }

        public int AskVolume { get; set; }
        
        #region IEqualityComparer<Quote> Members

        public bool Equals(Quote x, Quote y)
        {
            return x.GetHashCode() == y.GetHashCode();
        }

        public int GetHashCode(Quote obj)
        {
            return obj.GetHashCode();
        }

        #endregion

        public override int GetHashCode()
        {
            return BidPrice.GetHashCode() ^ BidVolume.GetHashCode() ^ AskPrice.GetHashCode() ^ AskVolume.GetHashCode();
        }

        public override bool Equals(object obj)
        {
            return obj.GetHashCode() == GetHashCode();
        }
    }
}
